/**
 * Created by Administrator on 2017/3/31 0031.
 */
'use strict';
import React, { Component } from 'react';
import {
    AppRegistry,
    StatusBar,
    Navigator,
    TouchableHighlight,
    Image,
    PixelRatio,
    ScrollView,
    Text,View,Button,
} from 'react-native';

import Head from './layout/Head';
import styles from '../assets/css/style.js';
var rem = (require('Dimensions').get('window').width)/7.5;
var her=(require('Dimensions').get('window').height)-1.92*rem;
var onePT=1/PixelRatio.get();
import Picker from 'react-native-picker';

export default class HeadOne extends Component{
    render(){
        var lists=[["首 页","icon_in"],["状态查看","icon_ck"],["设 置","icon_sz"]];
        return (
            <View style={[styles.flex,styles.bgcolor]}>
                <Head title="测试功能" list={lists}> </Head>
                <ImportPic> </ImportPic>
            </View>
        )
    }
}

class ImportPic extends Component{
    constructor(props){
        super(props);
        this.state={
            language:"请选择房型"
        }
    }

    togglePicker() {
        let data = [
        ['一室', '两室', '三室', '四室'],
        ['一厅', '两厅', '三厅', '四厅']];
        // for(var i=0;i<100;i++){
        //     data.push(i);
        // }
    
        Picker.init({
            pickerConfirmBtnText: '确定',
            pickerCancelBtnText: '取消',
            pickerTitleText: '请选择房型',
            pickerData: data,
            selectedValue: [1,5],
            onPickerConfirm: (data) => {
                this.setState({language: data})
            },
            onPickerCancel: (data) => {
                console.log(data);
            },
            onPickerSelect: (data) => {
                console.log(data);
            }
        });
        Picker.show();
    }

    render() {
        return (
            <View style={styles.flex}>
                <ScrollView style={styles.ztScroll}>
                    <View style={styles.Iptop}>
                        <View style={styles.IpPick}>
                            <Text style={styles.PickText} onPress={this.togglePicker.bind(this)}>{this.state.language}</Text>
                        </View>
                    </View>
                    <View style={[styles.center,{height:her}]}>
                        <View style={styles.Ipwrap}>
                            <Image
                                style={styles.Ip_Bgimg}
                                resizeMode="contain"
                                source={require('../../assets/img/bg_Ip.png')}
                            />
                            <View style={styles.Ipbut}>
                                <Text style={styles.IpFont}>导入房型图</Text>
                            </View>

                        </View>
                    </View>
                </ScrollView>


            </View>
        );
    }
}

//export default SimpleApp;
//module.exports=ZhuangTai;
AppRegistry.registerComponent('iHGuapp', () => HeadOne);